package com.aaa.behind.controller;


import com.aaa.behind.service.IGGoodsService;
import com.aaa.entity.GGoods;
import com.aaa.entity.Map;
import com.aaa.util.PageInfo;
import com.aaa.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商品表 前端控制器
 * </p>
 *
 * @author whj
 * @since 2023-01-30
 */
@RestController
@RequestMapping("/g-goods")
public class GGoodsController {



    @Autowired
    private IGGoodsService goodsService;


    @PostMapping("findAllGoods")
    public Result findAllGoods(@ModelAttribute PageInfo pageInfo, Map map){
        return new Result(goodsService.findAll(pageInfo, map));
    }

    @GetMapping("findAllSort")
    public Result findAllSort(){
        return new Result(goodsService.findAllSort());
    }

    @GetMapping("selectshop")
    public Result selectshop(){
        return new Result(goodsService.b_business_info());
    }


    @PostMapping("updateState")
    public Result updateState(GGoods gGoods){
        return new Result(goodsService.saveOrUpdate(gGoods));
    }




}

